package com.zzyl.task;


import cn.hutool.core.date.LocalDateTimeUtil;
import com.zzyl.mapper.ReservationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.concurrent.TimeUnit;

@Component
public class ReservationTask {

    @Autowired
    private ReservationMapper reservationMapper;

    /**
     * 每小时的第1分和第31分钟更新数据
     */
    @Scheduled(cron = "0 1,31 * * * ?" )
    public void reservationOverdue() {
        LocalDateTime now = LocalDateTime.now();
        reservationMapper.reservationOverdue(now);
    }


}
